package org.pi.common.plot.figures

trait Figure extends org.pi.common.observerpattern.Observable with org.pi.common.observerpattern.Observer {
  /** clear everything */
  def clear

  /** get the axes for a given index */
  def getAxes(index: Int) : org.pi.common.plot.axes.Axes
  /** get the axes for a given location in the figure (in screen pixels) */
  def getAxesIndex(x1: Float, y1: Float) : Int
  /** get the position within the axes (in axes coordinates) for a given location in the figure (in screen pixels) */
  def getPositionForAxes(x1: Float, y1: Float, index: Int) : (Float, Float)
  /** get the axes size in the figure (in screen pixels) */
  def getAxesSizeInPixels(index: Int) : (Float, Float)

  /** add an axes object, may also be a null object */
  def addAxes(x1: Float, y1: Float, x2: Float, y2: Float, axes: org.pi.common.plot.axes.Axes)
  /** add current axes into a grid of axes */
  def subplot(xn: Int, yn: Int, index: Int): Int
  /** add current axes into a grid of axes */
  def getAxesForSubplot(xn: Int, yn: Int, index: Int): org.pi.common.plot.axes.Axes
  /** set an axes objects to a previously added axes position and replace the previously added axes object */
  def setAxes(index: Int, axes: org.pi.common.plot.axes.Axes)
  def setCurrentAxes(axes: org.pi.common.plot.axes.Axes)
  def getCurrentAxes(): org.pi.common.plot.axes.Axes
  /** paint the figure to some graphics object */
  def paintFigure(graphics: java.awt.Graphics2D)
  /** save the current figure as image (png) */
  def saveAs(filename: String, width: Int, height: Int)
  /** save the current figure as image (png) */
  def saveAs(filename: String)
  /** activates figure, should bring the figure to the front in a GUI. */
  def activate
}
